package com.hzqy.service.street;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hzqy.persistence.dao.street.AreaStreetDao;
import com.hzqy.web.vo.SysAreaStreetVo;
import com.hzqy.web.vo.SysAreaVo;

@Service
public class AreaStreetServiceBean {

	@Resource
	private AreaStreetDao areaStreetDao;

	public Map<String, Object> selectAllarea(SysAreaStreetVo sysAreaStreetVo, int page, int rows) {
		Map<String, Object> streetMap = new HashMap<String, Object>();
		streetMap.put("f_sas_areaid", sysAreaStreetVo.getF_sas_areaid());
		streetMap.put("f_sas_parentid", sysAreaStreetVo.getF_sas_parentid());
		streetMap.put("f_sas_name", sysAreaStreetVo.getF_sas_name());
		List<SysAreaStreetVo> selectAllarea = areaStreetDao.selectAllarea(streetMap);
		if (selectAllarea == null) {
			streetMap.put("rows", new ArrayList<SysAreaStreetVo>());
		}else {
			streetMap.put("rows", selectAllarea);
		}
		
		return streetMap;
	}

	public int insertAreaStreet(SysAreaStreetVo sysAreaStreetVo) {
		return areaStreetDao.insertAreaStreet(sysAreaStreetVo);
	}

	public int updateAreaStreet(SysAreaStreetVo sysAreaStreetVo) {
		return areaStreetDao.updateAreaStreet(sysAreaStreetVo);
	}
	
	public int deleteAreaStreet(SysAreaStreetVo sysAreaStreetVo) {
		return areaStreetDao.deleteAreaStreet(sysAreaStreetVo);
	}
	
	public SysAreaStreetVo selectAllareaById(int f_sas_id) {
		return areaStreetDao.selectAllareaById(f_sas_id);
	}
	
	public List<SysAreaVo> selectSysArea() {
		return areaStreetDao.selectSysArea();
	}
}
